package net

import (
	"github.com/cloudwego/hertz/pkg/app"
	"github.com/cloudwego/hertz/pkg/common/utils"
	"net/http"
)

func Failed(ctx *app.RequestContext, code StatusCode, message string) {
	ctx.JSON(http.StatusOK, utils.H{
		"code":    code,
		"message": message,
	})
}

func Success(c *app.RequestContext, code StatusCode, data interface{}) {
	c.JSON(http.StatusOK, utils.H{
		"code":    code,
		"message": "success",
		"data":    data,
	})
}
